<?php 
class Application_Model_Filter_ServiceSearch{
    /**
     * 快速搜索
     */
    public $quick;
    /**
     * 内容类型
     */
    public $firstType;
    /**
     * 功能类型
     */
    public $functionType;
    /**
     * 紧急类型
     */
    public $urgencyType;
    /**
     * 开始时间
     */
    public $startTime;
    /**
     * 结束时间
     */
    public $endTime;
    /**
     * 状态
     */
    public $status;
            
    function getSearchFileds()
    {
        $where = array();
        $and = "";
        if($this->quick != "")
        {
            $firstLetter = substr($this->quick, 0, 1);
            if (strtoupper($firstLetter) == "F") {
                $storeno = "P" . strtoupper(substr($this->quick, 1, 5));
            } else {
                $storeno = $this->quick;
            }
            $where[" userName = "] = $this->quick;
            $where[" or storeNo = "] = $storeno;
            $where[" or qq = "] = $this->quick;
            $where[" or operator = "] = $this->quick; 
            $and = " and ";
        }
        if (!is_null($this->firstType) && $this->firstType != "") 
        {
            $where[$and." firstType = "] = $this->firstType;
            $and = " and ";
        }
        if (!is_null($this->functionType) && $this->functionType != "") 
        {
            $where[$and." functionType = "] = $this->functionType;
            $and = " and ";
        }
        if (!is_null($this->urgencyType) && $this->urgencyType != "") 
        {
            $where[$and." urgencyType = "] = $this->urgencyType;
            $and = " and ";
        }
        if ($this->startTime != "") 
        {
            $where[$and." dateCreated >= "] = $this->startTime." 00:00:00";
            $and = " and ";
        }
        if ($this->endTime != "")
        {
            $where[$and." dateCreated <= "] = $this->endTime." 23:59:59";
            $and = " and ";
        }
        if (!is_null($this->status) && $this->status != "") 
        {
            $where[$and." status = "] = $this->status;
            $and = " and ";
        }
        return $where;
    }
}
?>